package com.oms.common;

import com.baomidou.mybatisplus.core.enums.IEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.boot.context.properties.bind.DefaultValue;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;

/**
 * @Author zhanghailong
 * @Description TODO
 * @Date 19:48 2020/3/26
 */
@Data
@ApiModel
public class PageableVO<T extends IEnum<String>> implements Serializable {

    /**
     * 分页大小，最小1
     */
    @ApiModelProperty(value = "分页大小，最小1", example = "10", required = true)
    @Min( value = 1, message = "分页大小最低为1")
    @NotNull(message = "分页大小不能为空")
    private Integer size;

    /**
     * 页码，最小1
     */
    @ApiModelProperty(value = "页码大小，最小1", example = "1", required = true)
    @Min( value = 1, message = "页码大小最低为1")
    @NotNull(message = "页码大小不能为空")
    private Integer current;

    @ApiModelProperty(value = "排序字段")
    private List<SortForm<T>> sortList;

    @Override
    public String toString() {
        return "PageableVO{" +
                "size=" + size +
                ", current=" + current +
                ", sortList=" + sortList +
                '}';
    }
}
